<?php
/**
 * Config.php
 *
 * Part of Overtrue\Wechat\Shop
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @author    a9396 <a939638621@hotmail.com>
 * @copyright 2015 a939638621 <a939638621@hotmail.com>
 * @link      https://github.com/a939638621
 */

namespace Overtrue\Wechat\Shop;


use Overtrue\Wechat\Utils\MagicAttributes;
/**
 * Class Config
 * @property $appId
 * @property $appSecret
 * @property $debug
 *
 * @property $token
 * @property $encodingAESKey
 *
 * @property $mchId
 * @property $mchKey
 * @property $clientCert
 * @property $clientKey
 *
 */
Class Config extends MagicAttributes
{
    /**
     * 构造方法初始化参数
     *
     * @param null $appId
     * @param null $appSecret
     * @param bool|false $debug
     */
    public function __construct($appId,$appSecret = null,$debug = false)
    {
        //调试
        $this->debug = $debug;

        //基础参数
        $this->appId = $appId;
        $this->appSecret = $appSecret;
    }

    /**
     * 设置消息参数
     *
     * @param null $token
     * @param null $encodingAESKey
     */
    public function setMessageConfig($token,$encodingAESKey = null)
    {
        //消息参数
        $this->token = $token;
        $this->encodingAESKey = $encodingAESKey;
    }

    /**
     * 设置支付参数
     *
     * @param null $mchId
     * @param null $mchKey
     */
    public function setPayConfig($mchId, $mchKey)
    {
        $this->mchId = $mchId;
        $this->mchKey = $mchKey;

    }

    /**
     * 设置证书
     *
     * @param null $clientCert
     * @param null $clientKey
     */
    public function setPEMConfig($clientCert, $clientKey)
    {
        $this->clientCert = $clientCert;
        $this->clientKey = $clientKey;
    }

    public function __get($property)
    {

        return parent::__get($this->snake($property)); // TODO: Change the autogenerated stub
    }
}